package GoogleChartFactory;

import java.awt.Color;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author weinpau
 */
public class ColorGenerator implements Iterable<Color> {

    private List<Color> colors = new LinkedList<>();

    public ColorGenerator(int count, Color baseColor) {
        float[] hsv = Color.RGBtoHSB(baseColor.getRed(), baseColor.getGreen(), baseColor.getBlue(), null);
        for (float i = count - 1; i >= 0; i--) {
            colors.add(Color.getHSBColor(hsv[0],(1f / (float)(count+2))*(i+1),1f));
        }
    }

    @Override
    public Iterator<Color> iterator() {
        return colors.iterator();
    }
}
